import base64
import datetime
import json
import os
import pickle
import re
import sys
import django
from  django.http import JsonResponse
from django_redis import get_redis_connection

sys.path.insert(0, '../../../')
from django.test import TestCase

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lovehome_pro.settings.dev')
django.setup()
from xyuzi.models import House, Facility, HouseImage, Order, User, Area



# dict = {'action': 'accept','reason': '15as4fd3sa1df32asdf'}
#
# action = dict.get('action')
# reason = dict.get('reason')
#
# print(action)
#
# if not all(action):
#    print('no1')
#
# if action == 'accept':
#     try:
#         order= Order.objects.get(id=1)
#         status_count = order.status
#
#
#         status_count += 1
#         Order.objects.filter(id=1).update(status=status_count)
#
#         print(status_count)
#
#     except Exception as e:
#         print('no2')
# #
# if not all(reason):
#     print('no3')
#
# try:
#     Order.objects.filter(id=2).update(comment=reason)
#     print('yes')
#
# except Exception as e:
#     print('no4')


start_date = '2000-02-05'
end_date = '2000-03-09'


start = datetime.datetime.strptime(start_date, '%Y-%m-%d')
end = datetime.datetime.strptime(end_date, '%Y-%m-%d')


result = (end - start).days
print(result, type(result))






